function rotate(center, vector, deg) {
  const theta = deg2Rad(deg);

  const cosv = Math.cos(theta);
  const sinv = Math.sin(theta);

  const x = (vector.x - center.x) * cosv - (vector.y - center.y) * sinv + center.x;
  const y = (vector.x - center.x) * sinv - (vector.y - center.y) * cosv + center.y;

  return { x, y };
}

function deg2Rad(deg) {
  return deg * Math.PI / 180;
}